import 'dart:ffi';

import 'package:plugin_platform_interface/plugin_platform_interface.dart';

import 'stripe_terminal_tap_to_pay_method_channel.dart';

abstract class StripeTerminalTapToPayPlatform extends PlatformInterface {
  /// Constructs a StripeTerminalTapToPayPlatform.
  StripeTerminalTapToPayPlatform() : super(token: _token);

  static final Object _token = Object();

  static StripeTerminalTapToPayPlatform _instance = MethodChannelStripeTerminalTapToPay();

  /// The default instance of [StripeTerminalTapToPayPlatform] to use.
  ///
  /// Defaults to [MethodChannelStripeTerminalTapToPay].
  static StripeTerminalTapToPayPlatform get instance => _instance;

  /// Platform-specific implementations should set this with their own
  /// platform-specific class that extends [StripeTerminalTapToPayPlatform] when
  /// they register themselves.
  static set instance(StripeTerminalTapToPayPlatform instance) {
    PlatformInterface.verifyToken(instance, _token);
    _instance = instance;
  }

  Future<String?> getPlatformVersion() {
    throw UnimplementedError('platformVersion() has not been implemented.');
  }

  Future<void> init(String localId,String result)async{
    _instance.init(localId,result);
  }
  Future<Map> pay(String clientSecret)async{
    return await _instance.pay(clientSecret);
  }

  Future<bool> permissionAllowed() async{
    return await _instance.permissionAllowed();
  }

  Future<bool> cancelRetrievePaymentIntent() async{
    return await instance.cancelRetrievePaymentIntent();
  }

  Future<void> cancelProcessPayment() async {
    _instance.cancelProcessPayment();
  }
}
